package com.huidu.bitrade.controller.common;

import com.huidu.bitrade.util.MessageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.lang.reflect.InvocationTargetException;

@RestControllerAdvice
@Slf4j
public class GlobalController {

    @ExceptionHandler({Exception.class})
    public MessageResult exception(Exception e) {
        log.error(">>>拦截参数异常>>", e);
        return MessageResult.error(e.getMessage());
    }
}
